package com.zhucan.elastics.application.command.impl;

import com.zhucan.elastics.application.command.EmployeeCommandService;
import com.zhucan.elastics.application.command.assembler.EmployeeAssembler;
import com.zhucan.elastics.application.command.cmd.EmployeeCreateCommand;
import com.zhucan.elastics.domain.Employee;
import com.zhucan.elastics.domain.EmployeeRepository;
import lombok.AllArgsConstructor;
import org.springframework.stereotype.Service;

/**
 * @author: zhuCan
 * @date: 2019/12/20 9:48
 * @description:
 */
@Service
@AllArgsConstructor
public class EmployeeCommandServiceImpl implements EmployeeCommandService {

  private EmployeeAssembler employeeAssembler;

  private EmployeeRepository employeeRepository;

  @Override
  public Employee saveEmployee(EmployeeCreateCommand createCommand) {
    return employeeRepository.save(employeeAssembler.convertEntity(createCommand));
  }
}
